Solve a system of nonlinear equations using the Newton-Raphson method in parallel. More...
#include <newton_raphson_solver.hpp>
Public Types | |
typedef NonlinearSolverImplementation < T, I >::VectorType | VectorType |
typedef NonlinearSolverImplementation < T, I >::MatrixType | MatrixType |
typedef NonlinearSolverImplementation < T, I >::JacobianBuilder | JacobianBuilder |
typedef NonlinearSolverImplementation < T, I >::FunctionBuilder | FunctionBuilder |
Public Member Functions | |
NewtonRaphsonSolverT (const parallel::Communicator &comm, const int &local_size, JacobianBuilder form_jacobian, FunctionBuilder form_function) | |
Default constructor. | |
NewtonRaphsonSolverT (MatrixType &J, JacobianBuilder form_jacobian, FunctionBuilder form_function) | |
Construct with an existing Jacobian Matrix. | |
~NewtonRaphsonSolverT (void) | |
Destructor. |
Solve a system of nonlinear equations using the Newton-Raphson method in parallel.
This (fully functional) class is intended as an example of how to implement a nonlinear solver. It has no advantage over the general NonlinearSolver class, which relies on the underlying math library. It is, however, a drop-in replacement for NonlinearSolver.
Users of this class must specify functions or functors that build the Jacobian Matrix and the right hand side Vector. Typically, it's best to use functor classes or structs, since extra required information can be available to the Matrix/Vector construction.
This class is simply an interface to the NewtonRaphsonSolverImplementation class.
typedef NonlinearSolverImplementation<T, I>::FunctionBuilder gridpack::math::NewtonRaphsonSolverT< T, I >::FunctionBuilder |
Reimplemented from gridpack::math::NonlinearSolverT< T, I >.
typedef NonlinearSolverImplementation<T, I>::JacobianBuilder gridpack::math::NewtonRaphsonSolverT< T, I >::JacobianBuilder |
Reimplemented from gridpack::math::NonlinearSolverT< T, I >.
typedef NonlinearSolverImplementation<T, I>::MatrixType gridpack::math::NewtonRaphsonSolverT< T, I >::MatrixType |
Reimplemented from gridpack::math::NonlinearSolverT< T, I >.
typedef NonlinearSolverImplementation<T, I>::VectorType gridpack::math::NewtonRaphsonSolverT< T, I >::VectorType |
Reimplemented from gridpack::math::NonlinearSolverT< T, I >.
gridpack::math::NewtonRaphsonSolverT< T, I >::NewtonRaphsonSolverT | ( | const parallel::Communicator & | comm, | |
const int & | local_size, | |||
JacobianBuilder | form_jacobian, | |||
FunctionBuilder | form_function | |||
) |
Default constructor.
Collective.
A NonlinearSolver must be constructed simultaneously on all processes involved in comm
.
comm | communicator on which the instance is to exist | |
local_size | number Jacobian rows and Vector entries to be owned by this process | |
form_jacobian | function to fill the Jacobian Matrix, ![]() | |
form_function | function to fill the RHS function Vector, ![]() |
gridpack::math::NewtonRaphsonSolverT< T, I >::NewtonRaphsonSolverT | ( | MatrixType & | J, | |
JacobianBuilder | form_jacobian, | |||
FunctionBuilder | form_function | |||
) |
Construct with an existing Jacobian Matrix.
gridpack::math::NewtonRaphsonSolverT< T, I >::~NewtonRaphsonSolverT | ( | void | ) |
Destructor.
This must be called simultaneously by all processes involved in the communicator used for construction.